// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import iView from 'iview'
import store from '@/vuex/store'

import 'iview/dist/styles/iview.css'
Vue.config.productionTip = false
Vue.use(iView)
router.beforeEach((to, from, next) => {
  iView.LoadingBar.start();
  next();
});
router.afterEach((to, from, next) => {
  iView.LoadingBar.finish();
});
Vue.prototype.sysConfirm = function (content, okFun, cancelFun) {
  this.$Modal.confirm({
    title: '系统提示',
    content: content,
    okText: '确定',
    cancelText: '取消',
    onOk: () => {
      okFun()
    },
    onCancel: () => {
      cancelFun()
    }
  });
}
Vue.prototype.array_contain = function (array, obj) {
  for (var i = 0; i < array.length; i++) {
    if (array[i] == obj) //如果要求数据类型也一致，这里可使用恒等号===
      return true;
  }
  return false;
}
Vue.prototype.rmSame = function (arr) {
  var res = [];
  var json = {};
  for (var i = 0; i < arr.length; i++) {
    if (!json[arr[i]]) {
      res.push(arr[i]);
      json[arr[i]] = 1;
    }
  }
  return res
}
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  template: '<App/>',
  components: {
    App
  }
})